package cn.aitrox.ry.common.interceptor;

import cn.aitrox.ry.common.service.api.dto.User;
import org.springframework.stereotype.Component;

@Component
public class UserThreadLocal {

    private ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public User getUser() {
        return userThreadLocal.get();
    }

    public void setUser(User user) {
        userThreadLocal.set(user);
    }

    public void clear() {
        userThreadLocal.remove();
    }

}
